const Router = require('koa-router')
const {ordervalidator, verifyid,verifyorder_id} = require('../middleware/order.middleware')
const { addOrder ,getOrders, deleteOrder , updateOrder, getcommodity, addpay, getpay, delpay, logistics ,getlogistics} = require('../controller/order.controller')
const { update } = require('../service/category.service')
const router = new Router( {prefix: '/order'})
//创建订单
router.post('/createOrder',ordervalidator, verifyid, addOrder )
//获取订单列表
router.get('/getOrders', getOrders)
//删除订单
router.delete('/:id', verifyorder_id, deleteOrder)
//修改订单
router.post('/updateOrder/:id',verifyorder_id, updateOrder)
//添加商品查接口
router.get('/getcommodity', getcommodity)
//支付信息上传
router.post('/createpay', addpay )
//
router.get('/getpay/:id',getpay )
//删除支付结果
router.delete('/deletepay/:id', delpay )
//物流信息上传
router.post('/logistics', logistics);
//物流信息查询
router.get('/getlogistics/:id', getlogistics);

module.exports = router